package com.boot.generate.convert;

import com.boot.generate.enums.JavaTypeEnum;

/**
 * 实现mysql类型转java类型
 *
 * @author 【zhouJie】
 */
public class TypeImplConvert implements ITypeConvert {

    @Override
    public JavaTypeEnum processTypeConvert(String fieldType) {
        String t = fieldType.toLowerCase();
        if (t.contains("varchar") || t.contains("text")) {
            return JavaTypeEnum.STRING;
        } else if (t.contains("int") || t.contains("integer")) {
            return JavaTypeEnum.INTEGER;
        } else if (t.contains("bit")) {
            return JavaTypeEnum.BOOLEAN;
        } else if (t.contains("decimal")) {
            return JavaTypeEnum.BIGDECIMAL;
        } else if (t.contains("double")) {
            return JavaTypeEnum.DOUBLE;
        } else if (t.contains("datetime") || t.contains("date") || t.contains("time")) {
            return JavaTypeEnum.DATE;
        } else if (t.contains("float")) {
            return JavaTypeEnum.FLOAT;
        } else if (t.contains("bigint")) {
            return JavaTypeEnum.LONG;
        } else {
            return JavaTypeEnum.STRING;
        }
    }

}
